package study.day7;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class T7 {
    //缓冲流写入数据
    public static void main(String[] args) {
        Writer writer=null;
        BufferedWriter bw = null;
        try {
            writer=new FileWriter("C:\\Users\\DELL\\IdeaProjects\\file\\4.txt");
            bw = new BufferedWriter(writer);
            String word="今天天气很好";
            bw.write(word);
            System.out.println("写入成功");
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                bw.close();
                writer.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
